<div class="vheader">
    <h1><?php echo $this->translate("Loan master") ?></h1>
    <p><?php echo $this->replaceEmpty($this->LoanMasters->d->ClientFullName,$this->LoanMasters->d->GroupName) ?>
</div>

<div class="vcontent">

    
    <div class="cell">
        <dl>
            <dt><?php echo $this->translate("Master code") ?></dt>
            <dd><?php echo $this->LoanMasters->d->LoanMasterId ?></dd>  
            <dt><?php echo $this->translate("Borrower") ?></dt>
            <dd><?php echo $this->replaceEmpty($this->LoanMasters->d->ClientFullName,$this->LoanMasters->d->GroupName) ?></dd>  
            <dt><?php echo $this->translate("Amount") ?></dt>
            <dd><?php echo $this->LoanMasters->d->Amount ?></dd> 
            <dt><?php echo $this->translate("Installments") ?></dt>
            <dd><?php echo $this->LoanMasters->d->Installments ?> / <?php echo $this->LoanMasters->d->PaymentFrequency ?></dd>    
            <dt><?php echo $this->translate("Status") ?></dt>
            <dd><?php echo $this->LoanMasters->d->Status ?></dd>  
            <dt><?php echo $this->translate("Check number") ?></dt>
            <dd><?php echo $this->LoanMasters->d->CheckNumber ?></dd>
            <dt><?php echo $this->translate("Product line") ?></dt>
            <dd><?php echo $this->LoanMasters->d->ProductLineName ?></dd>  
            <dt><?php echo $this->translate("Program name") ?></dt>
            <dd><?php echo $this->LoanMasters->d->ProgramName ?></dd>
        </dl>    
    </div>
    
        
    <div class="cell">
        <dl>
            
            <dt><?php echo $this->translate("Tent. delivery date") ?></dt>
            <dd><?php echo $this->LoanMasters->d->TentativeDeliveryDate ?></dd>
            <dt><?php echo $this->translate("Tent. 1st. pmt. date") ?></dt>
            <dd><?php echo $this->LoanMasters->d->TentativeFirstPaymentDate ?></dd>
            
            <dt></dt><dd><br /></dd>
            
            <dt><?php echo $this->translate("Delivery date") ?></dt>
            <dd><?php echo $this->LoanMasters->d->DeliveryDate ?></dd>
            <dt><?php echo $this->translate("Exp. 1st. pmt. date") ?></dt>
            <dd><?php echo $this->LoanMasters->d->ExpectedFirstPaymentDate ?></dd>
            <dt><?php echo $this->translate("Exp. cancel date") ?></dt>
            <dd><?php echo $this->LoanMasters->d->ExpectedCancelDate ?></dd>
        </dl>    
    </div>
    
      
    <div class="cell">
        <dl>
            <dt><?php echo $this->translate("Branch") ?></dt>
            <dd><?php echo $this->LoanMasters->d->LocationName ?></dd>
            <dt><?php echo $this->translate("Loan officer") ?></dt>
            <dd><?php echo $this->LoanMasters->d->OfficerFullName ?></dd>
        </dl>  
        <?php if($this->LoanMasters->d->GroupId): ?>
            <img class="shadow" style="border: 0px solid #bcd; margin-top: 5px;"  src="/default/photo/thumb/cat/g/id/<?php echo $this->LoanMasters->d->GroupId ?>" /> 
        <?php endif; ?>
    </div>
            
    
</div>

<div class="vgrid">
    <dl class="horizontal">
        <?php foreach($this->LoanMasters->r->loans as $loan) : ?>
        <li>
            <dt><img style="border: 1px solid #bcd; margin-top: 5px;"  src="/default/photo/thumb/cat/i/id/<?php echo $loan->ClientId ?>" /></dt>
            <dd>
                <?php echo $this->link('/loan/loan/view', array('id'=>$loan->LoanId),$loan->ClientFullName) ?><br />
                <span class="label"><?php echo $this->translate("Status") ?>:</span> <?php echo $loan->Status ?><br />
                <span class="label"><?php echo $this->translate("Amount") ?>:</span> <?php echo $loan->Principal ?><br />
                <?php echo $this->link('/loan/loan/plan', array('id'=>$loan->LoanId),$this->translate("Payment schedule")) ?>  <br />
                <?php echo $this->link('/loan/loan/status-changes', array('id'=>$loan->LoanId),$this->translate("Status changes history")) ?>  <br />
                <?php echo $this->link('/survey/survey/apply', array('loan'=>$loan->LoanId),$this->translate("Survey results")) ?>
            </dd>
        </li>
        <?php endforeach; ?>
    </dl>
</div>

<!--
<div class="vgrid">
    <?php // echo $this->partial('partials/grid.phtml', $this->loanStatusChanges); ?>
</div>
-->    

<div class="vfooter">
    <div class="menu">
        
        <?php if($this->Menu->isChangeDatesOkay()): ?>
            <?php echo $this->link('/loan/application/change-dates', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Change dates")) ?>
        <?php endif; ?>
        
        <?php if($this->Menu->isReviewOkay()): ?>
            <?php echo $this->link('/loan/application/review', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Review")) ?>
        <?php endif; ?>
        
        <?php if($this->Menu->isApproveOkay()): ?>
            <?php echo $this->link('/loan/application/approve', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Approve")) ?>
        <?php endif; ?>
        
        <?php if($this->Menu->isExecuteOkay()): ?>
            <?php echo $this->link('/loan/application/execute', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Execute")) ?>
        <?php endif; ?>
        
        <?php if($this->Menu->isDisburseOkay()): ?>
            <?php echo $this->link('/loan/application/disburse', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Disburse")) ?>
        <?php endif; ?>
        
        <?php if($this->Menu->isRejectOkay()): ?>
            <?php echo $this->link('/loan/application/reject', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Reject")) ?>
        <?php endif; ?>
        
        <?php if($this->Menu->isWithdrawOkay()): ?>
            <?php echo $this->link('/loan/application/withdraw', array('id'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Withdraw")) ?>
        <?php endif; ?>
        
        <?php if($this->App->getDonations()->count()): ?>
            <?php echo $this->link('/sponsor/donation-allocation/browse', array('LoanMasterId'=>$this->LoanMasters->d->LoanMasterId),$this->translate("Sponsors"),array('target'=>'bottom')) ?>
        <?php endif; ?>
        
        <?php echo $this->printLink() ?> 
    </div>
</div>